/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.dengues.model.component.impl;

import java.util.Collection;

import org.dengues.model.component.ComponentPackage;
import org.dengues.model.component.ITEMSType;
import org.dengues.model.component.ITEMType;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>ITEMS Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.dengues.model.component.impl.ITEMSTypeImpl#getITEM <em>ITEM</em>}</li>
 *   <li>{@link org.dengues.model.component.impl.ITEMSTypeImpl#getDEFALUT <em>DEFALUT</em>}</li>
 *   <li>{@link org.dengues.model.component.impl.ITEMSTypeImpl#getNAME <em>NAME</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ITEMSTypeImpl extends EObjectImpl implements ITEMSType {
    /**
     * The cached value of the '{@link #getITEM() <em>ITEM</em>}' containment reference list.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getITEM()
     * @generated
     * @ordered
     */
    protected EList<ITEMType> iTEM;

    /**
     * The default value of the '{@link #getDEFALUT() <em>DEFALUT</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getDEFALUT()
     * @generated
     * @ordered
     */
    protected static final String DEFALUT_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getDEFALUT() <em>DEFALUT</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getDEFALUT()
     * @generated
     * @ordered
     */
    protected String dEFALUT = DEFALUT_EDEFAULT;

    /**
     * The default value of the '{@link #getNAME() <em>NAME</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getNAME()
     * @generated
     * @ordered
     */
    protected static final String NAME_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getNAME() <em>NAME</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getNAME()
     * @generated
     * @ordered
     */
    protected String nAME = NAME_EDEFAULT;

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected ITEMSTypeImpl() {
        super();
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    protected EClass eStaticClass() {
        return ComponentPackage.Literals.ITEMS_TYPE;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public EList<ITEMType> getITEM() {
        if (iTEM == null) {
            iTEM = new EObjectContainmentEList<ITEMType>(ITEMType.class, this, ComponentPackage.ITEMS_TYPE__ITEM);
        }
        return iTEM;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getDEFALUT() {
        return dEFALUT;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setDEFALUT(String newDEFALUT) {
        String oldDEFALUT = dEFALUT;
        dEFALUT = newDEFALUT;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, ComponentPackage.ITEMS_TYPE__DEFALUT, oldDEFALUT, dEFALUT));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getNAME() {
        return nAME;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setNAME(String newNAME) {
        String oldNAME = nAME;
        nAME = newNAME;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, ComponentPackage.ITEMS_TYPE__NAME, oldNAME, nAME));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
        switch (featureID) {
            case ComponentPackage.ITEMS_TYPE__ITEM:
                return ((InternalEList<?>)getITEM()).basicRemove(otherEnd, msgs);
        }
        return super.eInverseRemove(otherEnd, featureID, msgs);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public Object eGet(int featureID, boolean resolve, boolean coreType) {
        switch (featureID) {
            case ComponentPackage.ITEMS_TYPE__ITEM:
                return getITEM();
            case ComponentPackage.ITEMS_TYPE__DEFALUT:
                return getDEFALUT();
            case ComponentPackage.ITEMS_TYPE__NAME:
                return getNAME();
        }
        return super.eGet(featureID, resolve, coreType);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @SuppressWarnings("unchecked")
    @Override
    public void eSet(int featureID, Object newValue) {
        switch (featureID) {
            case ComponentPackage.ITEMS_TYPE__ITEM:
                getITEM().clear();
                getITEM().addAll((Collection<? extends ITEMType>)newValue);
                return;
            case ComponentPackage.ITEMS_TYPE__DEFALUT:
                setDEFALUT((String)newValue);
                return;
            case ComponentPackage.ITEMS_TYPE__NAME:
                setNAME((String)newValue);
                return;
        }
        super.eSet(featureID, newValue);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public void eUnset(int featureID) {
        switch (featureID) {
            case ComponentPackage.ITEMS_TYPE__ITEM:
                getITEM().clear();
                return;
            case ComponentPackage.ITEMS_TYPE__DEFALUT:
                setDEFALUT(DEFALUT_EDEFAULT);
                return;
            case ComponentPackage.ITEMS_TYPE__NAME:
                setNAME(NAME_EDEFAULT);
                return;
        }
        super.eUnset(featureID);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public boolean eIsSet(int featureID) {
        switch (featureID) {
            case ComponentPackage.ITEMS_TYPE__ITEM:
                return iTEM != null && !iTEM.isEmpty();
            case ComponentPackage.ITEMS_TYPE__DEFALUT:
                return DEFALUT_EDEFAULT == null ? dEFALUT != null : !DEFALUT_EDEFAULT.equals(dEFALUT);
            case ComponentPackage.ITEMS_TYPE__NAME:
                return NAME_EDEFAULT == null ? nAME != null : !NAME_EDEFAULT.equals(nAME);
        }
        return super.eIsSet(featureID);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public String toString() {
        if (eIsProxy()) return super.toString();

        StringBuffer result = new StringBuffer(super.toString());
        result.append(" (dEFALUT: ");
        result.append(dEFALUT);
        result.append(", nAME: ");
        result.append(nAME);
        result.append(')');
        return result.toString();
    }

} //ITEMSTypeImpl
